/**
 * oss配置文件，返回oss实例
 */
import { getOssPolicy } from '@/utils/auth'
import store from '@/store'

export async function getOss() {
  // 获取oss配置信息
  let policy = getOssPolicy()
  // 查看是否过期
  if (policy.loseTime - Date.now() <= 0) {
    // 重新发送请求
    await store.dispatch('user/getPolicy')
    policy = getOssPolicy()
  }
  return policy
}
